import Joi from '@hapi/joi';
import { paginateRule } from './common';

export const indexRule = {
  query: {
    ...paginateRule,
  },
};



export const editorRule = {
  query: {
    tplId: Joi.number().min(0),
    pageId: Joi.number().min(0),
  },
};



export const createRule = {
  body: {
    tpl: Joi.array()
      .items(Joi.object({
        templateId: Joi.number()
          .required(),
        pageId: Joi.number()
          .required(),
        portalId: Joi.number()
          .required(),
        enabled: Joi.number(),
        properties: Joi.string().required(),
        status: Joi.string()
      }))
  }
};